package com.pb.poem.service.impl;

import java.util.List;

import com.pb.poem.dao.PoemDao;
import com.pb.poem.entity.Common;
import com.pb.poem.entity.Poem;
import com.pb.poem.service.PoemService;
public class PoemServiceImpl implements PoemService{
	private PoemDao poemDao;
		public PoemDao getPoemDao() {
		return poemDao;
	}
	public void setPoemDao(PoemDao poemDao) {
		this.poemDao = poemDao;
	}
	// 查询数据库里所有的诗
	@Override
	public List<Poem> getPoemsList() {
		return poemDao.getPoemsList();
	}
	//删除自己的诗
	@Override
	public boolean delpoem(int id) {
		return poemDao.delpoem(id);
	}
	//更新诗内容
	@Override
	public boolean updatepoem(Poem poem) {
		return poemDao.updatepoem(poem);
	}
	//得到某首诗的评论
	@Override
	public List<Common> getCommonsList(int id) {
		return poemDao.getCommonsList(id);
	}
	//添加评论信息
	@Override
	public int addCommon(Common common) {
		return poemDao.addCommon(common);
	}
	//查询评论信息
	@Override
	public List<Common> getCommonByid(int id) {
		return poemDao.getCommonByid(id);
	}
	//根据Id查看一首诗
	@Override
	/*public Poem getPoemById(int id) {
			return poemDao.getPoemById(id);
	}*/
	public List<Poem> getPoemById(String uid){
      return poemDao.getPoemById(uid);
	}
	//得到总页数
	@Override
	public int getTotalProCount() {
		return poemDao.getTotalProCount();
	}
	//分页
	@Override
	public List<Poem> getPagePoemList(int id) {
		return poemDao.getPagePoemList(id);
	}
	//删除评论信息
	@Override
	public boolean delcommon(int pid) {
		return poemDao.delcommon(pid);
	}
	@Override
	public String create(String str) {
		return poemDao.create(str);
	}
	//添加个人生成的诗
	@Override
	public boolean addpoem(Poem poem) {
		return poemDao.addPoem(poem);
	}
	//得到所有诗的个数
	@Override
	public int getallpoemcount() {
		return poemDao.getallpoemcount();
	}
	//得到某个人的诗的个数
	@Override
	public int getonepoemcount(String author) {
		return poemDao.getonepoemcount(author);
	}
	
    /*
     *为个人生成的诗分页
     */
	//获取某个人诗的总数量
	@Override
	public int getonetotalProCount(String uid) {
		return poemDao.getonepoemcount(uid);
	}
	//分页
	@Override
	public List<Poem> getonePagePoemList(int id,String uid) {
		return poemDao.getonePagePoemList(id,uid);
	}
	
	/**
	 * 分页获取好友的诗
	 * @author Maocat
	 */
	@Override
	public List<Poem> getFriendPoems(int id, List<String> firendIds) {
		// TODO Auto-generated method stub
		return poemDao.getFriendPoems(id,firendIds);
	}
}
